﻿#pragma once

#include "resource.h"
#include <atlhost.h>

using namespace ATL;

// CAtlDialog

class CAtlDialog :
	public CAxDialogImpl<CAtlDialog>
{
public:
	CAtlDialog()
	{
	}

	~CAtlDialog()
	{
	}

	enum { IDD = 108 };

    BEGIN_MSG_MAP(CAtlDialog)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)
        COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel)
        CHAIN_MSG_MAP(CAxDialogImpl<CAtlDialog>)
        COMMAND_HANDLER(IDC_BTN_TEST, BN_CLICKED, OnBnClickedBtnTest)
    END_MSG_MAP()

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		CAxDialogImpl<CAtlDialog>::OnInitDialog(uMsg, wParam, lParam, bHandled);
		bHandled = TRUE;
		return 1;  // 让系统设置焦点
	}

	LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		EndDialog(wID);
		return 0;
	}

	LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		EndDialog(wID);
		return 0;
	}
    LRESULT OnBnClickedBtnTest(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
